Skip to content

feat(cast): add --sponsor-url for remote Tempo fee payer sponsorship#14790

Merged
mablr merged 19 commits into
masterfrom
feat/sponsor-url
May 25, 2026
Merged

feat(cast): add --sponsor-url for remote Tempo fee payer sponsorship#14790
mablr merged 19 commits into
masterfrom
feat/sponsor-url

Conversation

@decofe

@decofe decofe commented May 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds --sponsor-url (alias --tempo.sponsor-url) to cast send. When set, Foundry signs locally and routes the raw transaction through tempo-alloy's sponsor relay transport so the sponsor service can add its fee-payer signature.

Usage

cast send 0xDEAD... "transfer(address,uint256)" 0xBEEF... 100 \
  --sponsor-url https://sponsor.tempo.xyz/tp_abc123 \
  --private-key $PK

Or via env var:

export TEMPO_SPONSOR_URL=https://sponsor.tempo.xyz/tp_abc123
cast send 0xDEAD... --private-key $PK

How it works

  1. Build & fill the transaction using the regular RPC (gas estimation, nonce, etc.)
  2. Mark the transaction with FEE_PAYER_SIGNATURE_MARKER so the sender signs the sponsored payload
  3. Use RelayConnector with SponsorshipMode::SignOnly to call the sponsor service
  4. Broadcast the fully-sponsored transaction through the regular RPC

Changes

  • Cargo.toml / Cargo.lock: Bumped Tempo crates to the tempo-alloy@1.7.3 release rev.
  • crates/cast/src/cmd/send.rs: Replaced manual sponsor JSON-RPC/reqwest flow with tempo-alloy relay transport types.
  • crates/cast/Cargo.toml: Removed direct reqwest usage and added direct alloy-rpc-client usage for built-in connection strings.

Prompted by: @0xrusowsky

Adds --sponsor-url (alias --tempo.sponsor-url) to cast send. When set,
the transaction is signed locally and forwarded to the remote sponsor
service via eth_sendRawTransaction. The service adds its fee payer
signature and broadcasts the sponsored transaction.

Usage:
  cast send 0x... --sponsor-url https://sponsor.tempo.xyz/tp_abc123

This works with the existing fee-payer service in tempo-apps without
any changes — no new RPC methods required. The sponsor URL can also
be set via TEMPO_SPONSOR_URL env var.

Amp-Thread-ID: https://ampcode.com/threads/T-019e2d8c-7750-71a5-924c-2394c0c4e070
…nsor_url

- Use eth_signRawTransaction to get the sponsored tx from the service,
  then submit via the regular RPC's send_raw_transaction. This matches
  the viem withFeePayer sign-only protocol.
- Clone sponsor_url instead of take() so it's still present when
  TempoOpts::apply() runs, ensuring nonce_key=0 is set and the tx
  builds as a Tempo AA (0x76) type instead of EIP-1559 (0x02).
- Handle sponsor service error responses that have name/code but no
  message field.

Amp-Thread-ID: https://ampcode.com/threads/T-019e2d8c-7750-71a5-924c-2394c0c4e070
@mablr mablr self-assigned this May 18, 2026
mablr and others added 8 commits May 18, 2026 12:45
- Sign sponsored Tempo payload by setting a placeholder
  fee_payer_signature
  before local signing, so the sender commits to the sponsored variant
- Bail out when --sponsor-url is combined with --unlocked, --browser, or
  a
  Tempo access key instead of silently ignoring it
- Validate sponsor URL scheme (require https://, allow http only for
  localhost/127.0.0.1)
- Tighten JSON-RPC response parsing: accept arbitrary result types, drop
  non-standard 'name' error field

Co-authored-by: Amp <amp@ampcode.com>
@decofe decofe force-pushed the feat/sponsor-url branch from 18551b5 to 105e886 Compare May 25, 2026 07:16
@decofe decofe force-pushed the feat/sponsor-url branch from 105e886 to bd6cc4f Compare May 25, 2026 07:34

@mattsse mattsse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this pr has scope creep

Comment thread .github/workflows/ci-mpp.yml
Comment thread .github/workflows/ci-tempo.yml
Comment thread crates/anvil/src/eth/backend/mem/mod.rs
Comment thread crates/anvil/src/eth/backend/tempo.rs
mablr added 4 commits May 25, 2026 10:48
The previous commit bundled unrelated anvil backend refactoring
(amsterdam_eip8037_enabled plumbing) into a CI fix commit.
The tempo-alloy dependency tree pulls in criterion, which depends on
a crates.io package also named cast (v0.3.0). Using -p cast is now
ambiguous; --bin cast unambiguously targets the Foundry binary.
@mablr mablr marked this pull request as ready for review May 25, 2026 09:37
mablr added 2 commits May 25, 2026 14:16
The old check accepted bypass hostnames like localhost.evil.com and
127.0.0.1.evil.com; the new check inspects scheme() and host_str()
precisely.

@mablr mablr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some fixes: resolving browser/sponsor-url conflict shadowing, and more robust sponsor-url validation. RFR

@mattsse mattsse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving based on follow-up: the noted tradeoffs are acceptable for this PR.

@mablr mablr merged commit fca6310 into master May 25, 2026
19 checks passed
@mablr mablr deleted the feat/sponsor-url branch May 25, 2026 12:49
@github-project-automation github-project-automation Bot moved this to Done in Foundry May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants